﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using SZSLSystem.Common;
namespace SZSLSystem.SalesManagement.Project
{
    public partial class Modify : SZSLSystem.Web.UI.ManagePage
    {       
        protected void Page_Load(object sender, EventArgs e)
		{
			if (!Page.IsPostBack)
			{
			    ShowInfo();
			}
		}
	string TGuid
	{
		get
			{
                string tguid = SZSLSystem.Common.Utils.q("TGuid");
				return tguid;
			}
	}

	private void ShowInfo()
	{
		SZSLSystem.BLL.Project bll=new SZSLSystem.BLL.Project();
		SZSLSystem.Model.Project model=bll.GetModel(TGuid);
		this.lblOID.Text=model.OID;
		this.txtProjectName.Text=model.ProjectName;
		this.txtProjectAddress.Text=model.ProjectAddress;
		this.txtBuildCompany.Text=model.BuildCompany;
		this.txtDesignCompany.Text=model.DesignCompany;
		this.txtConstructionCompany.Text=model.ConstructionCompany;
		this.txtMarketingTel.Text=model.MarketingTel;
		this.txtMarketingCompany.Text=model.MarketingCompany;
		this.txtQualitativeInspectCompany.Text=model.QualitativeInspectCompany;
		this.txtPropertyManagement.Text=model.PropertyManagement;

	}

	public void btnUpdate_Click(object sender, EventArgs e)
	{
			string strErr="";
			if(this.txtProjectName.Text.Trim() =="")
			{
				strErr+="项目名称不能为空！\\n";	
			}
			if(this.txtProjectAddress.Text.Trim() =="")
			{
				strErr+="项目地址不能为空！\\n";	
			}
			if(this.txtBuildCompany.Text.Trim() =="")
			{
				strErr+="建设单位不能为空！\\n";	
			}
			if(this.txtDesignCompany.Text.Trim() =="")
			{
				strErr+="设计单位不能为空！\\n";	
			}
			if(this.txtConstructionCompany.Text.Trim() =="")
			{
				strErr+="施工单位不能为空！\\n";	
			}
			if(this.txtMarketingTel.Text.Trim() =="")
			{
				strErr+="营销电话不能为空！\\n";	
			}
			if(this.txtMarketingCompany.Text.Trim() =="")
			{
				strErr+="营销代理单位不能为空！\\n";	
			}
			if(this.txtQualitativeInspectCompany.Text.Trim() =="")
			{
				strErr+="质监单位不能为空！\\n";	
			}
			if(this.txtPropertyManagement.Text.Trim() =="")
			{
				strErr+="物业管理单位不能为空！\\n";	
			}

			if(strErr!="")
			{
                JscriptMsg(350, 230, "错误提示", "<b>出现错误了！</b><br/>" + strErr, "", "Error");
				return;
			}
			string ProjectName=this.txtProjectName.Text.Trim();
			string ProjectAddress=this.txtProjectAddress.Text.Trim();
			string BuildCompany=this.txtBuildCompany.Text.Trim();
			string DesignCompany=this.txtDesignCompany.Text.Trim();
			string ConstructionCompany=this.txtConstructionCompany.Text.Trim();
			string MarketingTel=this.txtMarketingTel.Text.Trim();
			string MarketingCompany=this.txtMarketingCompany.Text.Trim();
			string QualitativeInspectCompany=this.txtQualitativeInspectCompany.Text.Trim();
			string PropertyManagement=this.txtPropertyManagement.Text.Trim();


			SZSLSystem.Model.Project model=new SZSLSystem.BLL.Project().GetModel(TGuid);
			model.ProjectName=ProjectName;
			model.ProjectAddress=ProjectAddress;
			model.BuildCompany=BuildCompany;
			model.DesignCompany=DesignCompany;
			model.ConstructionCompany=ConstructionCompany;
			model.MarketingTel=MarketingTel;
			model.MarketingCompany=MarketingCompany;
			model.QualitativeInspectCompany=QualitativeInspectCompany;
			model.PropertyManagement=PropertyManagement;

			if (model==null) return;
			SZSLSystem.BLL.Project bll=new SZSLSystem.BLL.Project();
			bll.Update(model);
	}

    }
}
